from logging.handlers import RotatingFileHandler
import logging
from settings import real_env


#加载日志文件
#注意,此方法只生成日志文件,并不生成日志的文件夹
def load_log():
    logging.basicConfig(level=logging.WARNING)
    file_log_handler = RotatingFileHandler(real_env.LOG_DIR_NAME+'/logs', encoding='utf-8', maxBytes=1024 * 1024 * 100,
                                           backupCount=10)
    formatter = logging.Formatter('%(levelname)s %(filename)s:%(lineno)d %(message)s')
    file_log_handler.setFormatter(formatter)
    logging.getLogger().addHandler(file_log_handler)


